package com.ganmiao.enums;


import lombok.Getter;

@Getter
public enum UserTypeEnums {
    //"用户类型：1供应商；2商超；3骑手"

    USER_TYPE_SUPPLIER("1", "supplier"),
    USER_TYPE_SHOP("2", "shop"),
    USER_TYPE_RIDER("3", "rider"),
    USER_TYPE_MALL("4", "mall"),
    USER_TYPE_PLATFORM("5", "platform"),
    ;

    private final String code;
    private final String name;

    UserTypeEnums(String code, String name) {
        this.code = code;
        this.name = name;
    }

    // 根据code获取枚举实例
    public static UserTypeEnums getByCode(String code) {
        for (UserTypeEnums type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid UserType: code= " + code);
    }
}
